package com.example.bhservice.mailbox.config;


import lombok.Data;
import lombok.experimental.Accessors;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

/**
 * 邮件配置类
 *
 * @author lgy
 */
@Data
@Accessors(chain = true)
public class MailConfig {

    /**
     * 邮件配置id
     */
    private Long id;

    /**
     * 中心站地区
     */
    private String place;

    /**
     * SMTP server host. For instance, 'smtp.example.com'.
     */
    private String host;

    /**
     * SMTP server port.
     */
    private Integer port;

    /**
     * Login user of the SMTP server.
     */
    private String username;

    /**
     * Login password of the SMTP server.
     */
    private String password;

    /**
     * SMTP服务器使用的协议.
     */
    private String protocol = "smtp";

    /**
     * 默认MimeMessage编码.
     */
    private Charset defaultEncoding = StandardCharsets.UTF_8;

    /**
     * 其他JavaMail会话属性.= Map.of(
     * "mail.smtp.starttls.enable", "true",
     * "mail.smtp.starttls.required", "true",
     * "mail.smtp.ssl.enable", "true"
     * )
     */
    private Map<String, String> properties = new HashMap<String,String>(){{
        put("mail.smtp.starttls.enable", "true");
        put( "mail.smtp.starttls.required", "true");
        put("mail.smtp.ssl.enable", "true" );
    }};

}
